#include <iostream>
#include "PLC.h"
using namespace PLC;
using namespace std;
class A: public PLC_Function<INT>{
public:
	A(int funcID, varMap* vMap) : PLC_Function(funcID, vMap){
		this->addReturnVar<INT>();
		this->returnValue = new INT();
		::PLC::RFM->addVarToVarMap(237,createFuncVariable<INT>(237,(new INT(0))));
	}
	void funcExecute(INT*B){
		auto* B_t = new INT(::PLC::RFM->getSymbolByID<INT*>(237));
		*B_t = *B;

		*this->returnValue  = *B;
	}
	INT* callFunc(INT*B){
		funcExecute(B);
		return new INT(getFuncReturn<INT*>());
	}
};
class B: public PLC_Function<void>{
public:
	B(int funcID, varMap* vMap) : PLC_Function(funcID, vMap){
	}
	void funcExecute(){
		auto _B0=(*(new INT(1)));
		::PLC::RFM->getSymbolByID<A*>(219)->callFunc(&_B0);
	}
	void callFunc(){
		funcExecute();
		return NULL;
	}
};
void initFunc(){
	::PLC::RFM->addVarToVarMap(219, new A(219, RFM));
	::PLC::RFM->addVarToVarMap(238, new B(238, RFM));
}

int main(){
	initFunc();
		::PLC::RFM->getSymbolByID<B*>(238)->callFunc();
}